package com.kristin.threadlocal;

public class Test {

    static ThreadLocal<Integer> threadLocal = new ThreadLocal<>();

    public static void main(String[] args) {
        for (int i = 0 ; i < 5 ; i++) {
            int finalI = i;
            new Thread(new Runnable() {
                @Override
                public void run() {
                    threadLocal.set(new Integer(finalI));
                    System.out.println(Thread.currentThread().getName() + "----" +threadLocal.get());
                }
            }).start();
        }
    }

}
